using System.Collections;
using UnityEngine;

public class InGameTutorialOnEnable : InGameTutorialObject
{
	public float waitTime;

	public GameObject disable;

	private new void OnEnable()
	{
		for (int i = 0; i < values.Length; i++)
		{
			values[i].used = true;
		}
		for (int j = 0; j < values.Length; j++)
		{
			if (values[j].started)
			{
				StartCoroutine(WaitToUse());
			}
		}
	}

	private new void OnDisable()
	{
		for (int i = 0; i < values.Length; i++)
		{
			values[i].used = false;
		}
	}

	private IEnumerator WaitToUse()
	{
		yield return StartCoroutine(BCWUtils.WaitForRealSeconds(waitTime + 0.1f));
		Use();
	}

	public override bool OnStepStart(string name)
	{
		if (base.OnStepStart(name))
		{
			for (int i = 0; i < values.Length; i++)
			{
				if (values[i].used)
				{
					StartCoroutine(WaitToUse());
					if (disable != null)
					{
						disable.SetActive(false);
					}
					return true;
				}
			}
		}
		return false;
	}

	public override void OnEnd()
	{
		for (int i = 0; i < values.Length; i++)
		{
			values[i].used = false;
		}
		base.OnEnd();
	}
}
